﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using B10_Ex02_Elad_034695114_Meyron_026607788;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Infrastructure.ObjectModel;

namespace B10_Ex02_Elad_034695114_Meyron_026607788.ObjectModel
{
    public class PlayerBullet : Sprite
    {
        private const int k_BulletSpeed = -190;
        private const string k_AssetName = @"Sprites\Bullet";

        public PlayerBullet(Invadors i_game, Vector2 i_StartPos)
            : base(k_AssetName, i_game)
        {
            // Set the starting position
            this.Position = i_StartPos;

            // Player's bullet is red
            this.TintColor = Color.Red;

            // Set the speed
            this.Velocity = new Vector2(0, k_BulletSpeed);

            // Add to game components
            i_game.Components.Add(this);
        }

        /// <summary>
        /// Updates
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            // Check if the bullet went out of bounds
            if (this.Position.Y + this.Height < 0)
            {
                Distroy();
            }

            base.Update(gameTime);
        }
    }
}
